package com.tmall.wireless.tangram.example.card;

import android.content.Context;
import android.graphics.Bitmap;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.target.Target;
import com.bumptech.glide.request.transition.Transition;
import com.tmall.wireless.tangram.example.R;
import com.tmall.wireless.tangram.structure.BaseCell;
import com.tmall.wireless.tangram.structure.view.ITangramViewLifeCycle;

public class FlowerBase  extends FrameLayout implements ITangramViewLifeCycle {
    private TextView textView;
    private BaseCell cell;
    public FlowerBase(Context context) {
        super(context);
        init();
    }

    public FlowerBase(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public FlowerBase(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    private void init(){
        inflate(getContext(), R.layout.item_flower, this);
        textView = findViewById(R.id.name);
    }

    @Override
    public void cellInited(BaseCell cell) {
        setOnClickListener(cell);
        this.cell = cell;
    }

    @Override
    public void postBindView(BaseCell cell) {
        int pos = cell.pos;
        textView.setText(
                cell.optStringParam("title"));

    }

    @Override
    public void postUnBindView(BaseCell cell) {
    }

}
